<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>

<body>
  <h2>Guitar Wars - High Scores</h2>
  <p>Welcome, Guitar Warrior, do you have what it takes to crack the high score list? If so, just <a href="addscore.php">add your own score</a>.</p>
  <br />
  <?php 
  	require_once ('appvars.php');
  	require_once ('connectvars.php');
  	
  	$dbc=mysqli_connect(DB_HOST,DB_USER,DB_PASSWORD,DB_NAME);
  	
  	$query="select * from guitarwars order by score DESC,date ASC";
  	
  	$data=mysqli_query($dbc,$query);
  	echo '<table>';
  	$i=0;
  	while ($row=mysqli_fetch_array($data)){
  		if ($i==0){
  			echo '<tr><td>'. $row['score'] .'</td></tr>';
  		}
  		echo '<tr><td class="scoreinfo">';
  		echo '<span class="score">'.$row['score'].'</span><br/>';
  		echo '<strong>Name:</strong>'.$row['name'].'<br/>';
  		echo '<strong>Date:</strong>'.$row['date'].'</td>';
  		if(is_file(GW_UPLOADPATH.$row['screenshot'])&&filesize(GW_UPLOADPATH.$row['screenshot'])>0){
  			echo '<td><img src="' . GW_UPLOADPATH . $row['screenshot'] . '" alt="score image" /></td></tr>';
  		}
  		else {
  			echo '<td><img src="' . GW_UPLOADPATH . 'unverified.gif' . '" alt="Unverified score" /></td></tr>';
  		}
  		$i++;
  	}
  	echo '</table>';
  	mysqli_close($dbc);
  ?>
</body>
</html>